package com.zenithmind.exam.pojo.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 创建考试DTO
 * 
 * @author ZenithMind
 * @since 2024-07-01
 */
@Data
@Schema(name = "创建考试DTO", description = "创建考试的数据传输对象")
public class ExamCreateDTO {

    /**
     * 考试标题
     */
    @NotBlank(message = "考试标题不能为空")
    @Size(max = 200, message = "考试标题长度不能超过200个字符")
    @Schema(description = "考试标题")
    private String title;

    /**
     * 考试描述
     */
    @Schema(description = "考试描述")
    private String description;

    /**
     * 分类ID
     */
    @NotBlank(message = "分类ID不能为空")
    @Schema(description = "分类ID")
    private String categoryId;

    /**
     * 考试类型（1:练习, 2:作业, 3:考试, 4:竞赛）
     */
    @NotNull(message = "考试类型不能为空")
    @Schema(description = "考试类型（1:练习, 2:作业, 3:考试, 4:竞赛）")
    private Integer type;

    /**
     * 开始时间
     */
    @Schema(description = "开始时间")
    private LocalDateTime startTime;

    /**
     * 结束时间
     */
    @Schema(description = "结束时间")
    private LocalDateTime endTime;

    /**
     * 考试时长（分钟）
     */
    @Schema(description = "考试时长（分钟）")
    private Integer durationMinutes;

    /**
     * 及格分数
     */
    @Schema(description = "及格分数")
    private Integer passScore;

    /**
     * 考试说明
     */
    @Schema(description = "考试说明")
    private String instructions;

    /**
     * 是否打乱题目顺序
     */
    @Schema(description = "是否打乱题目顺序")
    private Boolean isShuffleQuestions;

    /**
     * 是否打乱选项顺序
     */
    @Schema(description = "是否打乱选项顺序")
    private Boolean isShuffleOptions;

    /**
     * 是否允许查看答案
     */
    @Schema(description = "是否允许查看答案")
    private Boolean allowReview;

    /**
     * 是否显示分数
     */
    @Schema(description = "是否显示分数")
    private Boolean showScore;

    /**
     * 是否自动提交
     */
    @Schema(description = "是否自动提交")
    private Boolean autoSubmit;

    /**
     * 题目列表
     */
    @Schema(description = "题目列表")
    private List<ExamQuestionDTO> questions;

    /**
     * 考试题目DTO
     */
    @Data
    @Schema(name = "考试题目DTO", description = "考试题目信息")
    public static class ExamQuestionDTO {
        
        /**
         * 题目ID
         */
        @NotBlank(message = "题目ID不能为空")
        @Schema(description = "题目ID")
        private String questionId;

        /**
         * 题目顺序
         */
        @Schema(description = "题目顺序")
        private Integer questionOrder;

        /**
         * 题目分值
         */
        @Schema(description = "题目分值")
        private Integer score;
    }
}
